package com.memo4android.model;

import com.memo4android.ui.NoteButton;
import com.memo4android.ui.NoteClickedListener;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.widget.BaseAdapter;
import android.widget.GridView;

public class FolderAdapter extends BaseAdapter {

	private Context mContext;
	private Dossier folder;

    public FolderAdapter(Context c, Dossier folder) {
        mContext = c;
        this.folder = folder;
    }

	public int getCount() {
		return folder.getNumberOfNotes();
	}

	public Object getItem(int arg0) {
		// TODO Auto-generated method stub
		return null;
	}

	public long getItemId(int arg0) {
		// TODO Auto-generated method stub
		return 0;
	}

	public View getView(int position, View convertView, ViewGroup parent) {
		ItemNote note = folder.getNote(position);
		NoteButton noteButton = new NoteButton(mContext, note);
		noteButton.setOnClickListener(new NoteClickedListener(mContext, note));
		noteButton.setLayoutParams(new GridView.LayoutParams(LayoutParams.FILL_PARENT, 70));
		return noteButton;			
	}

}
